package com.dragon.repository.domain.dto;

import com.dragon.common.util.BeanUtils;
import com.dragon.repository.entity.ContractFit;
import com.dragon.repository.entity.Quotes;
import com.dragon.repository.entity.QuotesProducts;
import com.dragon.repository.entity.WorkflowJson;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class QuotesDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    private Integer id;

    @ApiModelProperty(value = "客户id")
    private Integer customerId;

    @ApiModelProperty(value = "用户id（跟进人）")
    private Integer recodeId;

    @ApiModelProperty(value = "部门id")
    private Integer departmentId;

    @ApiModelProperty(value = "报价单号")
    private String quotesNumber;

    @ApiModelProperty(value = "价格")
    private Double price;

    @ApiModelProperty(value = "报价日期")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "更新日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date updateTime;

    @ApiModelProperty(value = "删除标识：0未删除1删除")
    private Integer deleted;

    @ApiModelProperty(value = "审核状态：0待审核 1审核通过 2审核不通过 3作废 4删除 ")
    private Integer status;

    @ApiModelProperty(value = "描述")
    private String description;

    @ApiModelProperty(value = "报价名称")
    private String quotesName;

    @ApiModelProperty(value = "付款方式描述")
    private String payDescription;

    @ApiModelProperty(value = "交货日期")
    private String deliveryTime;

    @ApiModelProperty(value = "验收标准")
    private String checkRule;

    @ApiModelProperty(value = "是否优惠 0否 1是")
    private Integer isDiscount;

    @ApiModelProperty(value = "优惠金额")
    private Double discountMoney;

    @ApiModelProperty(value = "客户名称")
    private String customerName;

    @ApiModelProperty(value = "工作流json")
    private List<WorkflowJson> workflowJsonList;

    @ApiModelProperty(value = "供应商产品")
    private List<QuotesProducts> products;

    @ApiModelProperty(value = "客户电话")
    private String telephone;

    @ApiModelProperty(value = "客户联系人")
    private String firstcontacter;

    @ApiModelProperty(value = "客户传真")
    private String fax;

    @ApiModelProperty(value = "申请人名称")
    private String adminName;

    @ApiModelProperty(value = "是否关联合同: 0,否，1,是")
    private Integer isContract;

    @ApiModelProperty(value = "结算方式")
    private Integer settlement;


    public QuotesDTO() {}

    public QuotesDTO(Quotes entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static QuotesDTO convert(Quotes entity) {
        return new QuotesDTO(entity);
    }

    public static List<QuotesDTO> convertList(List<Quotes> list) {
        List<QuotesDTO> resultList = new ArrayList<>();
        for (Quotes entity : list) {
            resultList.add(new QuotesDTO(entity));
        }
        return resultList;
    }}
